package org.application.factory;

import org.application.enums.PieceNameEnum;
import org.application.service.MoveValidator;
import org.application.service.impl.*;

public class MoveValidatorFactory {

    // 根据棋子的类型返回对应的 MoveValidator 实现
    public static MoveValidator createMoveValidator(PieceNameEnum name) {
        switch (name) {
            case ROOK:
                return new RookMoveValidator();   // 车的验证器
            case KNIGHT:
                return new KnightMoveValidator(); // 马的验证器
            case MINISTER:
                return new MinisterMoveValidator(); // 相的验证器 (Red side's "Elephant")
            case ELEPHANT:
                return new ElephantMoveValidator(); // 象的验证器 (Black side's "Elephant")
            case ADVISOR:
                return new AdvisorMoveValidator(); // 士的验证器
            case KING:
                return new KingMoveValidator();   // 帅的验证器 (Red side's King)
            case GENERAL:
                return new GeneralMoveValidator(); // 将的验证器 (Black side's General)
            case PAWN:
                return new PawnMoveValidator();   // 兵的验证器
            case SOLDIER:
                return new SoldierMoveValidator(); // 卒的验证器 (Black side's Soldier)
            case CANNON:
                return new CannonMoveValidator(); // 炮的验证器
            default:
                return null; // 如果没有匹配的棋子类型，返回 null 或抛出异常
        }
    }


}
